package com.thirdpartylogin.knowsolver.util;


import com.thirdpartylogin.callcenter.enums.AppException;
import com.thirdpartylogin.callcenter.enums.AppExceptionCodeMsg;
import jakarta.servlet.http.HttpSession;

public class IsNullOrEmpty {

    //判断登录状态
    public Integer CheckLoginStatus(HttpSession session){
        Integer login= (Integer) session.getAttribute(Conversation.USER_SESSSION);
        if (login==null){
            throw new AppException(AppExceptionCodeMsg.CHECKPOINTING);
        }
        return login;
    }

    public void IsUid(Integer uid){
        if (uid<=0){
            throw new AppException(AppExceptionCodeMsg.USER_NOT_ID);
        }
    }

    public void IsPassWord(String password){
        if (password==null || password.isEmpty()){
            throw new AppException(AppExceptionCodeMsg.PASSWORD_NOTNULL);
        }
    }

    public void IsAccount(String account){
        if (account==null || account.isEmpty()){
            throw new AppException(AppExceptionCodeMsg.ACCOUNT_NOTNULL);
        }
    }
}
